<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">

</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>后台数据统计分析
            <small>数据折线图</small>
        </h1>
    </div>
    <div class="content-header">
        请先选择日期
        <el-date-picker
                v-model="dateRange"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期">
        </el-date-picker>
        <el-button type="primary" @click="findDate" icon="el-icon-search">查询</el-button>

        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>每日预约和到诊数量</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
</div>
<div class="app-container">
    <div class="box">
        <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
        <div id="chart1" style="height:600px;"></div>
    </div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script src="../plugins/echarts/echarts.js"></script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例


    var vue = new Vue({
        el: '#app',
        data: {
            dateRange: ''//指定日期
        },
        created() {
            this.findNewDate();
        },
        methods: {
            findNewDate() {
                axios.get("/report/getOrderReport.do").then((res) => {
                    var myChart1 = echarts.init(document.getElementById('chart1'));
                    myChart1.setOption(
                        {
                            title: {
                                text: '后管数据统计(一)'
                            },
                            tooltip: {
                                trigger: 'axis',
                                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                                }
                            },
                            legend: {
                                right: 0,
                                data: ['每日预约数', '每日到诊数']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                orient: 'vertical',
                                show: true,
                                feature: {
                                    dataZoom: {
                                        yAxisIndex: 'none'
                                    }, //区域缩放，区域缩放还原
                                    dataView: {
                                        readOnly: false
                                    }, //数据视图
                                    magicType: {
                                        type: ['line', 'bar', 'stack']
                                    },  //切换为折线图，切换为柱状图
                                    restore: {},  //还原
                                    saveAsImage: {
                                        name: "后管数据统计",
                                    }   //保存为图片
                                },
                                right: '2%',
                                top: '6%',

                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: res.data.data.months
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: [
                                {
                                    name: '每日预约数',
                                    type: 'line',
                                    data: res.data.data.OrderCount
                                },
                                {
                                    name: '每日到诊数',
                                    type: 'line',
                                    data: res.data.data.VisitsCount
                                }
                            ]
                        });
                });
            },
            findDate() {
                axios.post("/report/getDateOrder.do", this.dateRange).then((res) => {
                    var myChart1 = echarts.init(document.getElementById('chart1'));
                    myChart1.setOption(
                        {
                            title: {
                                text: '后管数据统计(一)'
                            },
                            tooltip: {
                                trigger: 'axis',
                                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                                }
                            },
                            legend: {
                                right: 0,
                                data: ['每日预约数', '每日到诊数']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                orient: 'vertical',
                                show: true,
                                feature: {
                                    dataZoom: {
                                        yAxisIndex: 'none'
                                    }, //区域缩放，区域缩放还原
                                    dataView: {
                                        readOnly: false
                                    }, //数据视图
                                    magicType: {
                                        type: ['line', 'bar', 'stack']
                                    },  //切换为折线图，切换为柱状图
                                    restore: {},  //还原
                                    saveAsImage: {
                                        name: "后管数据统计",
                                    }   //保存为图片
                                },
                                right: '2%',
                                top: '6%',

                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: res.data.data.months
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: [
                                {
                                    name: '每日预约数',
                                    type: 'line',
                                    data: res.data.data.OrderCount
                                },
                                {
                                    name: '每日到诊数',
                                    type: 'line',
                                    data: res.data.data.VisitsCount
                                }
                            ]
                        });
                });
            }

        }
    });
</script>
</html>
